package com.itotem.android.everbridge.avtivity;

import com.itotem.android.everbridge.R;
import com.itotem.android.everbridge.R.layout;
import com.itotem.android.everbridge.R.menu;
import com.itotem.android.everbridge.view.SettingsView;

import android.os.Bundle;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.ViewFlipper;
import android.support.v4.app.NavUtils;

public class SettingsActivity extends Activity {
	
	public static int CURRENT_VIEW_PAGE = -1;
	public static int FIRST_SETTINGS_VIEW = 0;
	
	private ViewFlipper mViewFlipper;
	private SettingsView mSettingsView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SysApplication.getInstance().addActivity(this);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_settings);
        initViews();
    }
    
    private void initViews() {
    	mViewFlipper = (ViewFlipper)this.findViewById(R.id.settings_flipper);
    	mSettingsView = new SettingsView(this);
    	showContentPage(mSettingsView, FIRST_SETTINGS_VIEW);
    }

    /**
	 * init recommend listview
	 * 
	 * @param recommend_layout2
	 */

	public void showContentPage(final View v, int index) {
		CURRENT_VIEW_PAGE = index;
		showContentPage(v);
	}

	private void showContentPage(final View v) {
		int index = mViewFlipper.indexOfChild(v);
		if (index != -1) {
			mViewFlipper.setDisplayedChild(index);
			return;
		}
		mViewFlipper.addView(v);// add ViewFlipper containner
		mViewFlipper.setDisplayedChild(mViewFlipper.indexOfChild(v));

	}
    
}
